import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.event.ActionListener;

@SuppressWarnings("serial")
class IHMSon extends JPanel implements ActionListener {
	private JButton jouer = new JButton("jouer");
	private java.applet.AudioClip son;

	IHMSon() {
		// Premiere possibilite
//		java.net.URL url = JouerSon.class.getResource("sons/oiseau.au");

//		/* Seconde possibilite
		   java.net.URL url = null; 
		   try {	
		   url = new java.net.URL("http://www.infres.enst.fr/~hudry/coursJava/images/sons/oiseau.au");
		   } 
		   catch (java.net.MalformedURLException exc) {
		   exc.printStackTrace();
		   }
//		   */

		son = java.applet.Applet.newAudioClip(url); 

		add(jouer);
		jouer.addActionListener(this);
	} 

	public void actionPerformed(java.awt.event.ActionEvent e) {
		son.play();
	}
}

class JouerSon {
	public static void main(String[] argv) {
		JFrame fenetre = new JFrame();
		fenetre.setContentPane(new IHMSon());
		fenetre.pack();
		fenetre.setLocation(100, 100);
		fenetre.setVisible(true);
		fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	}
}